<style lang="less">
@import "@/styles/table-common.less";
// @import "./companyManage.less";
</style> 
<template>
  <div class="search">
    <Card>
      <Row class="operation">
        <Button @click="add" type="primary" icon="md-add">添加</Button>
      </Row>
      
      <Table
        :loading="loading"
        border
        :columns="columns"
        :data="data"
        sortable="custom"
        
        ref="table"
      >
        <!-- <template slot-scope="{ row }" slot="nickname">{{ row.user.nickname }}</template>
        <template slot-scope="{ row }" slot="mobile">{{ row.user.mobile }}</template> -->
      </Table>
      
    </Card>


    <!-- <check-password ref="checkPass" @on-success="resetPass" /> -->

    <addEdit
      :data="form"
      :type="showType"
      v-model="showUser"
      @on-submit="getDataList"
    />
  </div>
</template>

<script>
import {
  getFindAll,
  getAllCompany
} from "@/api/index";

import { shortcuts } from "@/libs/shortcuts";

import addEdit from "./addEdit.vue";
export default {
  name: "user-manage",
  components: {
    addEdit,
  },
  data() {
    return {
      message: "",
      height: 510,
      showUser: false,
      showType: "0",
      loading: true,
      options: {
        shortcuts: shortcuts,
      },
      columns: [
        {
          title: "性质ID",
          key: "id",
          minWidth: 200,
          align: "center"
        },
        {
          title: "性质名称",
          key: "title",
          minWidth: 100,
          align: "center"
        },
        {
          title: "创建人",
          key: "createBy",
          width: 145,
          align: "center",
        },
        {
          title: "创建时间",
          key: "createTime",
          minWidth: 200,
          align: "center"
        },
        
      ],
      data: [],
    };
  },
  methods: {
    init() {
      this.getDataList();
    },
    
   changeSort(e) {
      this.searchForm.sort = e.key;
      this.searchForm.order = e.order;
      if (e.order == "normal") {
        this.searchForm.order = "";
      }
      this.getDataList();
    },
    getDataList() {
      // 多条件搜索用户列表
      this.loading = true;
      getFindAll().then(res => {
        this.loading = false
        if (res.success) {
          this.data = res.result
        }
      })
     
    },
    add() {
      this.showType = "2";
      this.showUser = true;
    },

  },
  created() {
  },
  mounted() {
    // 计算高度
    this.height = Number(document.documentElement.clientHeight - 230);
    this.init();
    // getAllCompany({'companyName':'','companyTypeId':'','userNickName':''}).then(res => {
    //   console.log(res)
    // })
  },
};
</script>